package com.qf.course.web.exception;

import com.qf.course.core.util.Codes;
import com.qf.course.core.util.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * description:
 * author: Ken
 * 公众号：Java架构栈
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler
    public R exceptionHandler(Throwable t){
        System.err.println("==========全局异常触发!=============");
        t.printStackTrace();
        return R.createFail(Codes.FAIL);
    }
}
